Add a test for wildcard constraint warnings
authorSteven Fackler <sfackler@gmail.com>
Tue, 29 Sep 2015 05:30:40 +0000 (22:30 -0700)
committerSteven Fackler <sfackler@gmail.com>
Tue, 29 Sep 2015 05:30:40 +0000 (22:30 -0700)
tests/test_cargo_package.rs

index 5ca6b1cf6321822c5e822a4a293613c513e40d3e..6e59a364773b0089ca523b3ebc59e5d120ef9885 100644 (file)
@@ -9,7 +9,8 @@ use git2;
 use tar::Archive;
 
 use support::{project, execs, cargo_dir, paths, git, path2url};
-use support::{PACKAGING, VERIFYING, COMPILING, ARCHIVING};
+use support::{PACKAGING, VERIFYING, COMPILING, ARCHIVING, UPDATING, DOWNLOADING};
+use support::registry as r;
 use hamcrest::{assert_that, existing_file};
 
 fn setup() {
@@ -141,6 +142,61 @@ http://doc.crates.io/manifest.html#package-metadata for more info."));
         dir = p.url())));
 });
 
+test!(wildcard_deps {
+    r::init();
+
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.0.1"
+            authors = []
+            license = "MIT"
+            description = "foo"
+            repository = "bar"
+
+            [dependencies]
+            bar = "*"
+
+            [build-dependencies]
+            baz = "*"
+
+            [dev-dependencies]
+            buz = "*"
+        "#)
+        .file("src/main.rs", "fn main() {}");
+
+    r::mock_pkg("baz", "0.0.1", &[]);
+    r::mock_pkg("bar", "0.0.1", &[("baz", "0.0.1", "normal")]);
+    r::mock_pkg("buz", "0.0.1", &[("bar", "0.0.1", "normal")]);
+
+    assert_that(p.cargo_process("package"),
+                execs().with_status(0).with_stdout(&format!("\
+{packaging} foo v0.0.1 ({dir})
+{verifying} foo v0.0.1 ({dir})
+{updating} registry `{reg}`
+{downloading} [..] v0.0.1 (registry file://[..])
+{downloading} [..] v0.0.1 (registry file://[..])
+{downloading} [..] v0.0.1 (registry file://[..])
+{compiling} baz v0.0.1 (registry file://[..])
+{compiling} bar v0.0.1 (registry file://[..])
+{compiling} foo v0.0.1 ({dir}[..])
+",
+        packaging = PACKAGING,
+        verifying = VERIFYING,
+        updating = UPDATING,
+        downloading = DOWNLOADING,
+        compiling = COMPILING,
+        dir = p.url(),
+        reg = r::registry()))
+                .with_stderr("\
+warning: some dependencies have wildcard (\"*\") version constraints. On December 11th, 2015, \
+crates.io will begin rejecting packages with wildcard dependency constraints. See \
+http://doc.crates.io/crates-io.html#using-crates.io-based-crates for information on version \
+constraints.
+dependencies for these crates have wildcard constraints: bar, baz"));
+});
+
 test!(package_verbose {
     let root = paths::root().join("all");
     let p = git::repo(&root)